From c280ab99c5f820b166ad1a5962681fd82fa9e4c7 Mon Sep 17 00:00:00 2001 From: "awilliam@xenbuild.aw" Date: Sat, 3 Jun 2006 15:34:07 -0600 Subject: [PATCH] [IA64] Handle VTi's fp fault & trap in hypervisor instead of injecting to guest Signed-off-by : Zhang xiantao Signed-off-by : Kevin Tian --- xen/arch/ia64/vmx/vmx_process.c | 14 +++++++++++++- xen/arch/ia64/xen/process.c | 12 +++++------- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/xen/arch/ia64/vmx/vmx_process.c b/xen/arch/ia64/vmx/vmx_process.c index b86bee57ef..c6e4d0220c 100644 --- a/xen/arch/ia64/vmx/vmx_process.c +++ b/xen/arch/ia64/vmx/vmx_process.c @@ -62,6 +62,7 @@ extern unsigned long translate_domain_mpaddr(unsigned long mpaddr); extern void alt_itlb (VCPU *vcpu, u64 vadr); extern void itlb_fault (VCPU *vcpu, u64 vadr); extern void ivhpt_fault (VCPU *vcpu, u64 vadr); +extern unsigned long handle_fpu_swa (int fp_fault, struct pt_regs *regs, unsigned long isr); #define DOMN_PAL_REQUEST 0x110000 #define DOMN_SAL_REQUEST 0x110001 @@ -84,9 +85,20 @@ void vmx_reflect_interruption(UINT64 ifa,UINT64 isr,UINT64 iim, VCPU *vcpu = current; UINT64 vpsr = vmx_vcpu_get_psr(vcpu); vector=vec2off[vector]; - if(!(vpsr&IA64_PSR_IC)&&(vector!=0x1400)){ + if(!(vpsr&IA64_PSR_IC)&&(vector!=IA64_DATA_NESTED_TLB_VECTOR)){ panic_domain(regs, "Guest nested fault vector=%lx!\n", vector); } + else{ // handle fpswa emulation + // fp fault + if(vector == IA64_FP_FAULT_VECTOR && !handle_fpu_swa(1, regs, isr)){ + vmx_vcpu_increment_iip(vcpu); + return; + } + //fp trap + else if(vector == IA64_FP_TRAP_VECTOR && !handle_fpu_swa(0, regs, isr)){ + return; + } + } VCPU(vcpu,isr)=isr; VCPU(vcpu,iipa) = regs->cr_iip; if (vector == IA64_BREAK_VECTOR || vector == IA64_SPECULATION_VECTOR) diff --git a/xen/arch/ia64/xen/process.c b/xen/arch/ia64/xen/process.c index dc24f065d7..631b5fc209 100644 --- a/xen/arch/ia64/xen/process.c +++ b/xen/arch/ia64/xen/process.c @@ -447,7 +447,7 @@ fp_emulate (int fp_fault, void *bundle, unsigned long *ipsr, /* * Handle floating-point assist faults and traps for domain. */ -static unsigned long +unsigned long handle_fpu_swa (int fp_fault, struct pt_regs *regs, unsigned long isr) { struct vcpu *v = current; @@ -477,11 +477,6 @@ handle_fpu_swa (int fp_fault, struct pt_regs *regs, unsigned long isr) PSCBX(v, fpswa_ret) = ret; printk("%s(%s): fp_emulate() returned %ld\n", __FUNCTION__, fp_fault?"fault":"trap", ret.status); - } else { - if (fp_fault) { - /* emulation was successful */ - vcpu_increment_iip(v); - } } return ret.status; @@ -869,7 +864,10 @@ ia64_handle_reflection (unsigned long ifa, struct pt_regs *regs, unsigned long i // FIXME: Should we handle unaligned refs in Xen?? vector = IA64_UNALIGNED_REF_VECTOR; break; case 32: - if (!(handle_fpu_swa(1, regs, isr))) return; + if (!(handle_fpu_swa(1, regs, isr))) { + vcpu_increment_iip(v); + return; + } printf("ia64_handle_reflection: handling FP fault\n"); vector = IA64_FP_FAULT_VECTOR; break; case 33: -- 2.30.2